<!-- 审核弹框 -->

<template>
  <div>
    <!-- <Alert type="error">
      <h5>SellOrder.js文件中的扩展SellOrder表的头部信息,你可以在此处定义需要显示的信息,如果需要获取界面的Vue对象属性,参照此扩展组件GridHeaderExtend.vue的说明</h5>
    </Alert> -->
    <!--点击扩展按钮对应的弹出框-->
    <vol-box :model.sync="model" title="审核" :width="650" :height="430">
      <div style="margin-bottom: 20px">
        <vol-table
          ref="table"
          :doubleEdit="false"
          :columns="columns"
          :max-height="200"
          :index="true"
          :tableData="setRows"
          :paginationHide="true"
        ></vol-table>
      </div>
      <!-- <ExamineList ref="examineList" :setRows="setRows"></ExamineList> -->
      <VolForm
        ref="myform"
        :loadKey="loadKey"
        :formFileds="formFileds"
        :formRules="formRules"
      ></VolForm>
      <!-- 添加slot槽覆盖footer的按钮，添加新的按钮 -->
      <div slot="footer">
        <Button type="success" @click="getFirstRow">保存</Button>
        <Button type="info" @click="close">关闭</Button>
      </div>
    </vol-box>
  </div>
</template>
<script>
import VolTable from "@/components/basic/VolTable.vue";
import VolForm from "@/components/basic/VolForm.vue";
export default {
  components: {
    VolBox: () => import("@/components/basic/VolBox.vue"),
    VolForm,
    VolTable,
  },
  data() {
    return {
      // 表格
      columns: [
        {
          field: "id",
          title: "账务表主键",
          type: "int",
          width: 90,
          hidden: true,
          readonly: true,
          require: true,
          align: "left",
        },
        {
          field: "accountingCode",
          title: "记账代码",
          bind: { key: "creditedtype", data: [] },
          type: "string",
          width: 220,
          align: "left",
          sortable: true,
        },
        {
          field: "debit",
          title: "收入",
          type: "string",
          width: 220,
          align: "left",
          summary: true,
        },
        {
          field: "lender",
          title: "支出",
          type: "string",
          width: 220,
          align: "left",
          summary: true,
        },
        {
          field: "orderNumber",
          title: "订单号",
          type: "int",
          width: 90,
          align: "left",
        },
        {
          field: "startingTime",
          title: "发生时间",
          type: "datetime",
          width: 90,
          align: "left",
          sortable: true,
        },
        {
          field: "customerName",
          title: "客人姓名",
          type: "string",
          width: 220,
          align: "left",
        },
        {
          field: "amountSettled",
          title: "已结金额",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "qutstandingAmount",
          title: "未结金额",
          type: "decimal",
          width: 90,
          align: "left",
        },
        {
          field: "sign",
          title: "标志",
          type: "string",
          width: 220,
          align: "left",
        },
        {
          field: "businessDay",
          title: "营业日",
          type: "string",
          width: 220,
          align: "left",
        },
        {
          field: "status",
          title: "状态",
          type: "string",
          width: 220,
          align: "left",
        },
        {
          field: "origin",
          title: "来源地",
          type: "string",
          width: 220,
          align: "left",
        },
        // {field:'isAvailable',title:'是否可用',bind: { key: 'enable', data: [] },type:'sbyte',width:90,align:'left'},
        // {field:'isDelete',title:'是否删除',bind: { key: 'enable', data: [] },type:'int',width:90,require:true,align:'left'},
        {
          field: "referenceInformation",
          title: "参考信息",
          type: "string",
          width: 220,
          align: "left",
        },
        {
          field: "remarks",
          title: "备注",
          type: "string",
          width: 220,
          align: "left",
        },
        {
          field: "createDate",
          title: "创建时间",
          type: "datetime",
          width: 90,
          align: "left",
          sortable: true,
        },
        // {field:'createID',title:'创建人ID',type:'int',width:90,hidden:true,align:'left'},
        {
          field: "creator",
          title: "创建人",
          type: "string",
          width: 180,
          align: "left",
        },
        {
          field: "modifier",
          title: "修改人",
          type: "string",
          width: 180,
          align: "left",
        },
        {
          field: "modifyDate",
          title: "修改时间",
          type: "datetime",
          width: 90,
          align: "left",
          sortable: true,
        },
        // {field:'modifyID',title:'修改人ID',type:'int',width:90,hidden:true,align:'left'},
      ],
      setRows:[],//表格数据
      // 表单
      loadKey: true,
      model: false,
      formFileds: {
        remarks: "",
      },
      formRules: [
        [
          {
            required: true, //是否必填
            title: "备注",
            field: "remarks", //字段，与表单字段必须相同
            type: "textarea", //标签类型
            colSize: 12, //每行列的宽度，可选值:12,8,6,如果是12标签会占100%宽度
            min: 2,
          },
        ],
      ],
    };
  },
  methods: {
    getFirstRow() {
      console.log("保存");
      this.$refs.myform.validate((result) => {
        if (result) {
          // let formData = {
          //   mainData: this.formFileds,
          //   detailData: null,
          //   delKeys: null,
          // };
          // this.http.post("/api/Mall_accounting/Add", formData, true).then((x) => {
          //   if (!x.status) return this.$message.error(x.message);
          //   this.$message.success(x.message);
          //   this.model = false;
          //   let data = { startingTime: new Date() };
          //   this.$refs.myform.reset(data);
          //   this.close();
          //   // this.refresh();
          // });
        }
      });

      //this.$message.error();
      //   this.$emit("parentCall", $vue => {
      //     let rows = $vue.$refs.table.rowData;
      //     this.$message.error(
      //       rows.length == 0 ? "表格没有数据" : JSON.stringify(rows[0])
      //     );
      //此于拿到的$vue你可以操作其中的任何对象，如:
      //props.js中的属性，this.columns/this.editFormFileds
      //或者操作其他动态扩展的组件如:$vue.$refs.gridBody/$vue.$refs.gridFooter
      //$vue.$refs.table获取表格信息
      //$vue.refresh()刷新表格等操作
      //能操作的所有对象可参照props.js与ViewGird.uve的属性
      //能操作的方法methods.js/detailMethods.js
      //   });
    },
    close() {
      console.log("取消");
      this.model = false;
      // this.formFileds.remarks = "";
      this.$refs.table.load();
    },
  },
  created() {},
};
</script>
